/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Project2.cs342.project1.mathNotebook.data;

/**
 *
 * @author Kevin
 */
public class DESPasswordGenerator {

    private String randomPassword;

    char[] charBank = {'a', 'b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9'};

    public DESPasswordGenerator(){

        randomPassword = "";

    }

    /**
     * Generates a random DES key as a String.
     *
     */
    public void generateRandomPassword(){
        String randomString = "";
        int randomIndex = 0;
        for(int i = 0; i < 50; i++){
            randomIndex = (int)((charBank.length-1) * Math.random());
            randomString = randomString + charBank[randomIndex];
        }

        randomPassword = randomString;

    }

    /**
     * Returns the randomly generated DES key.
     *
     * @return Random DES key as a String
     */
    public String getRandomPassword(){
        return randomPassword;
    }

}
